(function () {
function __$styleInject(css) {
    var head = document.head || document.getElementsByTagName('head')[0],
        style = document.createElement('style');

    style.type = 'text/css';
    if (style.styleSheet) {
        style.styleSheet.cssText = css || '';
    } else {
        style.appendChild(document.createTextNode(css) || '');
    }
    head.appendChild(style);
}
__$styleInject(".loading-ui{position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;background:rgba(0,0,0,.6);z-index:99}.loading-ui .loaded{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}")
}());
(function () {
'use strict';

var $AppConfig = function (Vue, options) {

    var params = { userAccount: null }; //url参数列表
    window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) {
        if (/\?userAccount=/.test(value)) {
            //解决IOS旧版客户端遗留的问题
            var arr = value.split('?userAccount=');
            value = arr[0];
            params.userAccount = arr[1];
        }
        params[key] = value;
    });
    var getToken = params.access_token;
    var inApp = !!getToken;
    var INTERFACE_HOST = 'http://118.178.236.122:9001/selfdriving/api'; //本地调试 使用mock搭建静态数据服务
    var isIos = /ipod|ipad|iphone|mac os x/i.test(navigator.userAgent);

    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };

        if (/(y+)/i.test(format)) {
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        }

        for (var k in o) {
            if (new RegExp("(" + k + ")").test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
            }
        }
        return format;
    };
    Vue.$AppConfig = Object.assign({
        urlParams: params,
        inApp: inApp,
        isIos: isIos,
        INTERFACE_HOST: INTERFACE_HOST,
        getToken: getToken,
        appJSBridge: function (key, message) {
            if (typeof window.JsBridge == 'object' && typeof window.JsBridge[key] == 'function') {
                message == undefined ? window.JsBridge[key]() : window.JsBridge[key](message);
                return true;
            } else if (typeof window.webkit == 'object') {
                try {
                    message == undefined ? window.webkit.messageHandlers[key].postMessage("") : window.webkit.messageHandlers[key].postMessage(message);
                    return true;
                } catch (e) {
                    console.log(e);
                    return false;
                }
            } else {
                return false;
            }
        }
    }, typeof options === "function" ? options() : options);
};

var loading = { render: function () {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _vm.loading ? _c('div', { staticClass: "loading-ui" }, [_c('div', { staticClass: "loaded", attrs: { "data-loader": "ball-rotate" } })]) : _vm._e();
    }, staticRenderFns: [], _scopeId: 'data-v-4d4d6dc1',
    name: "loading-ui",
    props: {
        loading: {
            type: Boolean,
            default: false
        }
    },
    data: function () {
        return {};
    }
};

var $vm = void 0;
var loadingUI = {
    install: function (Vue, option) {
        if (!$vm) {
            var Loading = Vue.extend(loading);
            $vm = new Loading({
                el: document.createElement('div')
            });
            document.body.appendChild($vm.$el);
        }
        Vue.$loading = {
            show: function () {
                $vm.loading = true;
            },
            hide: function () {
                $vm.loading = false;
            }
        };
        Vue.mixin({
            created: function () {
                this.$loading = Vue.$loading;
            }
        });
    }
};

var svgLineUi = { render: function () {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('svg', { ref: "experLin", staticClass: "exper-lin", attrs: { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 186 20" } });
    }, staticRenderFns: [], _scopeId: 'data-v-34df7650',
    name: "svg-lin-ui",
    props: {},
    methods: {
        anime: function () {

            for (var i = 0; i < 19; i++) {
                anime({
                    targets: ".exper-lin .line-" + i,
                    y2: {
                        value: [0, 20]
                    },
                    //                        strokeDashoffset: [anime.random(-30, 0), anime.random(10, 30)],
                    duration: anime.random(100, 500),
                    elasticity: 200,
                    easing: 'linear',
                    direction: 'alternate',
                    loop: true
                });
            }
        }
    },
    mounted: function () {
        var _this = this;

        var dom = this.$refs.experLin;
        var lineW = 2;
        for (var i = 0, num = 0; i < 186; i += lineW + 8, num++) {
            var rectObj = document.createElementNS("http://www.w3.org/2000/svg", "line");
            rectObj.setAttribute("class", "line line-" + num);
            rectObj.setAttribute("x1", i);
            rectObj.setAttribute("x2", i);
            rectObj.setAttribute("y1", 0);
            rectObj.setAttribute("y2", 20);
            dom.appendChild(rectObj);
        }

        this.$nextTick(function () {

            _this.anime();
        });
    }
};

var svgLatticeUi = { render: function () {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('svg', { ref: "experLattice", staticClass: "exper-lattice", attrs: { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 750 20" } });
    }, staticRenderFns: [], _scopeId: 'data-v-00ba2e90',
    name: "svg-lattice-ui",
    props: {},
    methods: {
        anime: function () {

            var dom = this.$refs.experLattice;
            var lin = dom.querySelectorAll('.line');

            anime({
                targets: lin,
                fill: {
                    // value: ['#020732', '#005a73'],
                    value: '#005a73',
                    duration: 700,
                    easing: 'easeInOutQuart'
                },
                // stroke: {
                //     value: ['#3b5998', '#4099ff'],
                //     duration: 700,
                //     delay: 200,
                //     easing: 'easeInOutQuart'
                // },
                easing: 'linear',
                duration: this.animeTime,
                direction: 'alternate',
                delay: function (el, i, l) {
                    return i * 200;
                },
                loop: true
            });
        }
    },
    mounted: function () {
        var _this = this;

        var dom = this.$refs.experLattice;
        var w = 25;
        for (var i = 0; i < 750; i += w + 0.1) {
            var rectObj = document.createElementNS("http://www.w3.org/2000/svg", "rect");
            rectObj.setAttribute("class", 'line');
            rectObj.setAttribute("x", i);
            rectObj.setAttribute("y", 0);
            rectObj.setAttribute("width", w);
            rectObj.setAttribute("height", 20);
            dom.appendChild(rectObj);
        }

        this.$nextTick(function () {
            _this.anime();
        });
    }
};

var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};





function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;
}

var alloyLever = createCommonjsModule(function (module, exports) {
    /*!
     *  AlloyLever v1.0.2 By dntzhang
     *  Github: https://github.com/AlloyTeam/AlloyLever
     *  MIT Licensed.
     */
    (function (root, factory) {
        module.exports = factory();
    })(commonjsGlobal, function () {
        var AlloyLever = {};
        AlloyLever.settings = {
            cdn: '//s.url.cn/qqun/qun/qqweb/m/qun/confession/js/vconsole.min.js',
            reportUrl: null,
            reportPrefix: '',
            reportKey: 'msg',
            otherReport: null,
            entry: null
        };

        AlloyLever.store = [];

        var methodList = ['log', 'info', 'warn', 'debug', 'error'];
        methodList.forEach(function (item) {
            var method = console[item];

            console[item] = function () {
                AlloyLever.store.push({
                    logType: item,
                    logs: arguments
                });

                method.apply(console, arguments);
            };
        });

        AlloyLever.logs = [];
        AlloyLever.config = function (config) {
            for (var i in config) {
                if (config.hasOwnProperty(i)) {
                    AlloyLever.settings[i] = config[i];
                }
            }

            if (config.entry) {
                window.addEventListener('load', function () {
                    AlloyLever.entry(config.entry);
                });
            }

            var parameter = getParameter('vconsole');

            if (parameter) {
                if (parameter === 'show') {
                    AlloyLever.vConsole(true);
                } else {
                    AlloyLever.vConsole(false);
                }
            }
        };

        AlloyLever.vConsole = function (show) {
            loadScript(AlloyLever.settings.cdn, function () {

                //support vconsole3.0
                if (typeof vConsole === 'undefined') {
                    vConsole = new VConsole({
                        defaultPlugins: ['system', 'network', 'element', 'storage'],
                        maxLogNumber: 5000
                    });
                }

                var i = 0,
                    len = AlloyLever.store.length;

                for (; i < len; i++) {
                    var item = AlloyLever.store[i];
                    //console[item.type].apply(console, item.logs)
                    //prevent twice log
                    item.noOrigin = true;
                    vConsole.pluginList.default.printLog(item);
                }

                if (show) {
                    try {
                        vConsole.show();
                    } catch (e) {}

                    window.addEventListener('load', function () {
                        vConsole.show();
                    });
                }
            });
        };

        AlloyLever.entry = function (selector) {
            var count = 0,
                entry = document.querySelector(selector);
            if (entry) {
                entry.addEventListener('click', function () {
                    count++;
                    if (count > 5) {
                        count = -10000;
                        AlloyLever.vConsole(true);
                    }
                });
            }
        };

        window.onerror = function (msg, url, line, col, error) {
            var newMsg = msg;

            if (error && error.stack) {
                newMsg = processStackMsg(error);
            }

            if (isOBJByType(newMsg, "Event")) {
                newMsg += newMsg.type ? "--" + newMsg.type + "--" + (newMsg.target ? newMsg.target.tagName + "::" + newMsg.target.src : "") : "";
            }

            newMsg = (newMsg + "" || "").substr(0, 500);

            AlloyLever.logs.push({
                msg: newMsg,
                target: url,
                rowNum: line,
                colNum: col
            });

            if (msg.toLowerCase().indexOf('script error') > -1) {
                console.error('Script Error: See Browser Console for Detail');
            } else {
                console.error(newMsg);
            }

            var ss = AlloyLever.settings;
            if (ss.reportUrl) {
                var src = ss.reportUrl + (ss.reportUrl.indexOf('?') > -1 ? '&' : '?') + ss.reportKey + '=' + (ss.reportPrefix ? '[' + ss.reportPrefix + ']' : '') + newMsg + '&t=' + new Date().getTime();
                if (ss.otherReport) {
                    for (var i in ss.otherReport) {
                        if (ss.otherReport.hasOwnProperty(i)) {
                            src += '&' + i + '=' + ss.otherReport[i];
                        }
                    }
                }
                new Image().src = src;
            }
        };

        function loadScript(src, callback) {
            var s, r, t;
            r = false;
            s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = src;
            s.onload = s.onreadystatechange = function () {
                //console.log( this.readyState ); //uncomment this line to see which ready states are called.
                if (!r && (!this.readyState || this.readyState == 'complete')) {
                    r = true;
                    callback();
                }
            };
            t = document.getElementsByTagName('script')[0];
            t.parentNode.insertBefore(s, t);
        }

        function getParameter(n) {
            var m = window.location.hash.match(new RegExp('(?:#|&)' + n + '=([^&]*)(&|$)')),
                result = !m ? '' : decodeURIComponent(m[1]);
            return result || getParameterByName(n);
        }

        function getParameterByName(name, url) {
            if (!url) url = window.location.href;
            name = name.replace(/[\[\]]/g, "\\$&");
            var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, " "));
        }

        function isOBJByType(o, type) {
            return Object.prototype.toString.call(o) === "[object " + (type || "Object") + "]";
        }

        function processStackMsg(error) {
            var stack = error.stack.replace(/\n/gi, "").split(/\bat\b/).slice(0, 9).join("@").replace(/\?[^:]+/gi, "");
            var msg = error.toString();
            if (stack.indexOf(msg) < 0) {
                stack = msg + "@" + stack;
            }
            return stack;
        }

        function getCookie(name) {
            var arr,
                reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

            if (arr = document.cookie.match(reg)) return unescape(arr[2]);else return null;
        }

        AlloyLever.getCookie = getCookie;
        AlloyLever.getParameter = getParameter;
        AlloyLever.loadScript = loadScript;

        return AlloyLever;
    });
});

alloyLever.config({
    entry: "#experience" //请点击这个DOM元素6次召唤vConsole。//你可以通过AlloyLever.entry('#entry2')设置多个机关入口召唤神龙
});

if (window.Vue) {
    Vue.use($AppConfig, {});
    Vue.use(loadingUI);
    Vue.component(svgLineUi.name, svgLineUi);
    Vue.component(svgLatticeUi.name, svgLatticeUi);
    var vm = new Vue({
        el: '#experience',
        data: {
            footNum: 0,
            animeTime: 4000
        },
        methods: {
            //判断是否是微信浏览器的函数
            isWeiXin: function () {
                var ua = window.navigator.userAgent.toLowerCase();
                if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                    return true;
                } else {
                    return false;
                }
            },
            carMove: function () {
                var _this = this;

                var moveY = '-3.7rem';
                var docHeight = document.body.clientHeight || document.documentElement.clientHeight;
                if (docHeight >= 800) {
                    moveY = '-4.2rem';
                }
                anime({
                    targets: '#carMove',
                    translateY: ['4rem', moveY],
                    easing: 'linear',
                    duration: this.animeTime
                });
                anime({
                    targets: '#carMove .exper-warp-box-car',
                    translateY: ['4rem', 0],
                    scale: [5, 1],
                    easing: 'linear',
                    duration: this.animeTime
                });
                anime({
                    targets: '#carMove .exper-warp-box-lamp',
                    scale: [5, 1],
                    easing: 'linear',
                    duration: this.animeTime
                });

                var basicTimeline = anime.timeline();
                basicTimeline.add({
                    targets: '.exper-warp-content_btn',
                    opacity: [0, 1],
                    easing: 'linear',
                    duration: 750,
                    delay: 2000
                }).add({
                    targets: '.exper-warp-content_btn',
                    scale: [1, 1.5],
                    easing: 'linear',
                    duration: 250
                }).add({
                    targets: '.exper-warp-content_btn',
                    scale: [1.5, 1],
                    easing: 'linear',
                    duration: 250
                }).add({
                    targets: '#carMove .exper-warp-box-title',
                    scale: [5, 0],
                    opacity: [0, 1],
                    rotateX: [180, 180],
                    easing: 'linear',
                    duration: 1000
                }).add({
                    targets: '#carMove .exper-warp-box-title',
                    scale: [0, 1],
                    rotateX: [180, 0],
                    easing: 'linear',
                    duration: 200
                });

                // anime({
                //     targets: '.exper-warp-content_btn',
                //     opacity: {
                //         value: [0, 1],
                //         duration: 1000,
                //         delay: 2000
                //     },
                //     scale: {
                //         value: [1, 1.5],
                //         duration: 250,
                //         delay: 3000
                //     },
                //     easing: 'linear',
                // })
                anime({
                    targets: '#carLine',
                    translateY: ['8rem', '0'],
                    easing: 'linear',
                    duration: this.animeTime,
                    delay: 500
                });
                anime({
                    targets: '#oil',
                    strokeDashoffset: [anime.random(0, -50), anime.random(-90, -180)],
                    easing: 'linear',
                    direction: 'alternate',
                    loop: true,
                    duration: this.animeTime,
                    update: function (anim) {
                        _this.footNum = Math.round(anim.progress);
                    }
                });
                anime({
                    targets: '#pointer',
                    rotate: function () {
                        return [anime.random(-120, -20), anime.random(20, 120)];
                    },
                    easing: 'linear',
                    duration: this.animeTime,
                    direction: 'alternate',
                    loop: true
                });
            },
            appDown: function () {
                if (Vue.$AppConfig.isIos) {
                    window.location.href = "https://itunes.apple.com/cn/app/%E9%95%BF%E5%AE%89%E5%87%BA%E8%A1%8C/id1136083257?mt=8";
                } else {
                    window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.ccclubs.changan";
                }
            }
        },
        mounted: function () {
            var _this2 = this;

            setTimeout(function () {
                try {
                    document.body.removeChild(document.getElementById('loading'));
                    _this2.carMove();
                } catch (e) {}
            }, 800);
        }
    });
}

}());
